'''
Created on Oct 8, 2012

@author: gohew
'''
from numpy import *
import serial
import matplotlib.pyplot as plt
from scipy.constants.constants import pi

if __name__ == '__main__':
    pass

t = arange(1024)    
f = 0.05;
print pi
sine_wave = cos(2*pi*f*t) + sin(2*pi*0.02*t)
val = fft.fft(exp(2j * pi * arange(8) / 8))
sp = fft.fftshift(fft.fft(sine_wave))
print(sp)
freq = fft.fftshift(fft.fftfreq(t.shape[-1]))
plt.plot(freq, abs(sp),'b-',freq,sine_wave,'g-')
plt.show()